<%@ page language="java" import="java.util.*,com.animal.dao.*,com.animal.bean.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>个人信息</title>

<link rel="stylesheet" type="text/css" href="./bootstrap/css/bootstrap.min.css">
<link href="./bootstrap/css/styles.css" rel="stylesheet">

<base href="<%=basePath%>">

</head>

<body>
	<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
		<div class="container-fluid">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#sidebar-collapse">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="ExperimentalFileManager.html"><span>实验动物</span>档案管理</a>
				<ul class="user-menu">
					<li class="dropdown pull-right">
						<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-user"></span> User <span class="caret"></span></a>
						<ul class="dropdown-menu" role="menu">
							<li><a href="http://www.cau.edu.cn"><span class="glyphicon glyphicon-user"></span> Profile</a></li>
							<li><a href="#"><span class="glyphicon glyphicon-cog"></span> Settings</a></li>
							<li><a href="login.jsp"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li>
						</ul>
					</li>
				</ul>
			</div>				
		</div>
	</nav>
		
	<div id="sidebar-collapse" class="col-sm-3 col-lg-2 sidebar">
		<form role="search">
			<div class="form-group">
				<input type="text" class="form-control" placeholder="Search">
			</div>
		</form>
		<ul class="nav menu">
			<li class="parent ">
				<a href="ExperimentalPersonalInfo.jsp">
					<span class="glyphicon glyphicon-list"></span> 管理员信息 <span data-toggle="collapse" href="#sub-item-1" class="icon pull-right"><em class="glyphicon glyphicon-s glyphicon-plus"></em></span> 
				</a>
				<ul class="children collapse" id="sub-item-1">
					<li>
						<a class="" href="ExperimentalPersonalInfo.jsp">
							<span class="glyphicon glyphicon-share-alt"></span> 个人信息
						</a>
					</li>
					<li>
						<a class="" href="ExperimentalChangePassword.jsp">
							<span class="glyphicon glyphicon-share-alt"></span> 修改密码
						</a>
					</li>
				</ul>
			</li>
			
			<li class="parent ">
				<a href="ExperimentalPersonalInfo.jsp">
					<span class="glyphicon glyphicon-list"></span> 实验档案管理 <span data-toggle="collapse" href="#sub-item-2" class="icon pull-right"><em class="glyphicon glyphicon-s glyphicon-plus"></em></span> 
				</a>
				<ul class="children collapse" id="sub-item-2">
					<li>
						<a class="" href="ExperimentalFileManagement.jsp">
							<span class="glyphicon glyphicon-share-alt"></span> 管理档案
						</a>
					</li>

				</ul>
			</li>
			
			<li role="presentation" class="divider"></li>
			<li><a href="login.jsp"><span class="glyphicon glyphicon-user"></span>登录页面</a></li>
		</ul>
		<div class="attribution">Created by <a href="#">软工第9组</a></div>
	</div><!--/.sidebar-->
		
	
	<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">			
		<div class="row">
			<ol class="breadcrumb">
				<li><a href="ExperimentalFileManager.html"><span class="glyphicon glyphicon-home"></span></a></li>
				<li class="active">管理员信息 > 个人信息</li>
			</ol>
		</div>
		
		
		
		<!-- 从这开始添加代码 -->
		
		<div class="row">
			<div class="col-lg-12">

				<table class="table table-striped">
				<!-- <table width="800px" bordercolor="#3399FF" border="2px" align="center"> -->
  					<h3><center><b>实验档案管理员信息</b></center></h3><br>
					  <thead>
					    <tr>
					      <th>编号</th>				
					      <!-- <th>密码</th> -->
					      <th>姓名</th>
					      <th>性别</th>
					      <th>手机号</th>
					      <th>职位</th>
					      <th>邮箱</th>
					      <th>操作</th>
					    </tr>
					  </thead>
					  
					  <tbody>
<%
					
					//Cookie从LoginCheck.jsp中获取ID
 					String id=null;
   					Cookie[] cookies=request.getCookies();
   					for(int i=0;i<cookies.length;i++) {
   						if(cookies[i].getName().equals("id")) {
   							id=cookies[i].getValue();
   							break;
   						}
   					}
   					
   					//session从LoginCheck.jsp中获取ID
					//String id = (String)session.getAttribute("ID");
					
					ManagerBean manager = ManagerManage.selectByID(id);

%>
 					  <tr>
					      <td><%=manager.getID() %></td>
					      <td><%=manager.getName() %></td>
					      <td><%=manager.getGender() %></td>
					      <td><%=manager.getPhoneNumber() %></td>
					      <td><%=manager.getPosition() %></td>
					      <td><%=manager.getEmail() %></td>
					      <td>
					      	<input class="form-inline;form-control btn btn-primary " type="button" value="编辑" onclick="display('lb')" />
					      </td>
					    </tr>
					  </tbody>
				</table>
			</div>
		</div>

			<div class="row" id="lb" style="display:none">
			<div class="col-md-4 col-md-offset-4">
			<div class="login-panel panel panel-default" >
				<div class="panel-heading"><center><b>修改</b></center></div>
				<div class="panel-body">
					<form name="form1" method="post" action="UpdateServlet?do=changeperson">
						<fieldset>
							<div class="form-group">
								编号：<input class="form-control"  placeholder="ID" name="ID" type="text" value="<%=manager.getID() %>" readonly>
								<!-- <span class="help-block" style="color:red;">ID不能修改</span> -->
							</div>
							<div class="form-group">
								姓名：<input class="form-control" placeholder="请输入姓名" name="Name" type="text" value="<%=manager.getName() %>">
							</div>
							<%-- <div class="form-group">
								性别：<input class="form-control" placeholder="请输入性别" name="Gender" type="text" value="<%=manager.getGender() %>">
							</div> --%>
							
							<div class="form-group">
								性别：
							<%
									String Gender = manager.getGender();
			  						if(Gender.equals("male")){
		  					%>
		  							<input type="radio" name="Gender" value="male" checked>&emsp;男&emsp;&emsp;
		  							<input type="radio" name="Gender" value="female">&emsp;女
		  					<%
		  							}
		  							else if(Gender.equals("female")){
		  					%>
		  							<input type="radio" name="Gender" value="male">&emsp;男&emsp;&emsp;
		  							<input type="radio" name="Gender" value="female" checked>&emsp;女
		  					<%			
		  							}
		  							else{
		  					%>
		  							<input type="radio" name="Gender" value="male" checked>&emsp;男&emsp;&emsp;
		  							<input type="radio" name="Gender" value="female">&emsp;女>
		  					<%		
		  							}
							%>								
							</div>
							
							<div class="form-group">
								手机号：<input class="form-control" placeholder="请输入手机号" name="PhoneNumber" type="text" value="<%=manager.getPhoneNumber() %>">
							</div>
							<div class="form-group">
								职位：<input class="form-control" placeholder="职位" name="Position" type="text" value="<%=manager.getPosition() %>" readonly>
								<!-- <span class="help-block" style="color:red;"> 职位不能修改</span> -->
							</div>	
							<div class="form-group">
								邮箱：<input class="form-control" placeholder="请输入邮箱" name="Email" type="text" value=<%=manager.getEmail() %>>
							</div>
							<div class="form-group">
								<table width="350px"><tr><td>
									<input type="button" class="form-control btn btn-primary"  name="submit " value="提交"  onclick="dl();" style="width:50%;margin-left:25%;"/>
   									</td><td>
   									<input type="reset" class="form-control btn btn-primary"  name="reset" value="重置"  style="width:50%;margin-left:25%;"/>
									</td></tr>
								</table>
							
							</div>
						</fieldset>
					</form>
				</div>
			</div>
			</div>
			</div>
		
	</div>
	
	
	<script src="./bootstrap/js/jquery-3.1.0.min.js"></script>
	<script src="./bootstrap/js/bootstrap.min.js"></script>

<script type="text/javascript">
	function display(id){  
        var traget=document.getElementById(id);
        if(traget.style.display=="none"){  
            traget.style.display="";  
        }
        else{  
            traget.style.display="none";  
      	}
   }
	
	function dl()
	{
		if(form1.Name.value==null||form1.Name.value==""){
			alert("请输入姓名");
			window.document.location.href="ExperimentalPersonalInfo.jsp";
			//var name=prompt("请输入姓名");
            //form1.Name.value=name;
		}
		else if(form1.Gender.value==""||form1.Gender.value==""){
			alert("请输入性别");
			window.document.location.href="ExperimentalPersonalInfo.jsp";
		}
		else if(form1.PhoneNumber.value==null||form1.PhoneNumber.value==""){
			alert("请输入手机号");
			window.document.location.href="ExperimentalPersonalInfo.jsp";
		}
		else if(form1.Email.value==null||form1.Email.value==""){
			alert("请输入邮箱");
			window.document.location.href="ExperimentalPersonalInfo.jsp";
		}
		else{
			//alert("修改成功!");
			form1.submit();
	  	}
	}

</script>

</body>

</html>
